package wjl.project.dubbotestshop.DesignMode;

import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

//@Component
public class PayFactory {
    private  static Map<String, PayHandler> pay_map =  new HashMap<>(8);

    public PayFactory() {
    }

    public static void RegisterPayMethod(String name, PayHandler method){
        if (name==null||method==null){
            return;
        }
        pay_map.put(name,method);
        System.out.println(name+"成功注册到工厂中");
    }
    public static PayHandler invokePayHandler(String handlerName){
        return pay_map.get(handlerName);
    }
}
